home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
rascal.arc
/
LC.RAS
< prev
next >
Wrap
Text File
|
1980-01-01
|
640b
|
26 lines
'Sample Rascal program to count the lines in an ASCII file.
PROCEDURE MAIN
ON ERROR GOTO CHECK.FOR.EOF
INPUT "File Name"; FILE.NAME$
OPEN FILE.NAME$ FOR INPUT AS #1
LINE.COUNT = 0 : DONE.SW = 0
REPEAT
LINE INPUT #1, L$
LINE.COUNT = LINE.COUNT+1
UNTIL DONE.SW = 1
PRINT "There are";LINE.COUNT-1;"lines in ";FILE.NAME$
ENDPROC
CHECK.FOR.EOF|
ERROR.CODE = ERR : ERROR.LINE = ERL
IF ERROR.CODE = 62
DONE.SW = 1
RESUME NEXT
ELSE
PRINT "BASIC error";ERROR.CODE;"at";ERROR.LINE
STOP 'Immediately halt program
ENDIF
END